// @ts-check
import { put, post } from '../../../utils/requests.js'
// @ts-ignore
import { carService, orderService } from '@/utils/env'

/**
 * 编辑临时表车辆列表
 * @description 编辑临时表车辆列表
 * @returns {Promise<{ code: string, message: string, data: string }>} 返回值：
 */
const putCar = (data, query) => {
  const url = carService + '/data/car'
  return put(url, data, {}, true, query)
}

/**
 * 车辆审核
 * @param {object} data
 * @param {object} headers 请求头
 */
const patchLenderCarInfo = (data, headers, query) => {
  const url = carService + '/data/car'
  return put(url, data, headers, true, query)
}

/**
 * 编辑车辆出租位置
 * @description 编辑车辆出租位置
 * @returns {Promise<{ code: string, message: string, data: string }>} 返回值：
 */
const putCarRentRule = (data) => {
  const url = carService + '/data/car_rent_rule'
  return put(url, data, {}, true)
}

/**
 * 编辑车辆出租位置
 * @description 编辑车辆出租位置
 * @returns {Promise<{ code: string, message: string, data: string }>} 返回值：
 */
const postCarGeom = (data) => {
  const url = orderService + '/api/order/calculate_thegeom'
  return post(url, data, {}, true)
}

export {
  putCar,
  patchLenderCarInfo,
  putCarRentRule,
  postCarGeom
}
